﻿<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<style type="text/css">
#albumEdit {
	margin: 0 0 0 40px;
	line-height: 2;
}

#albumEdit input.txt, #albumEdit select, #albumEdit textarea.txt {
	width: 200px;
}

#albumEdit img {
	width: 100px;
}
</style>


<div id="content-title">
	<h3>${message}</h3>
</div>
<div id="content-main">
	<form action="hom/save" method="post" enctype="multipart/form-data">
		<input type="hidden" name="id" value="${album==null?0:album.id}" />
	<table id="albumEdit">
		<tr>
			<td>唱片名称：</td>
			<td><input class="txt" type="text" name="title"
				value="${album.title}" /><label class="error"></label></td>
		</tr>
		<tr>
			<td>唱片封面：</td>
			<td><img src="CoverImages/${album.id}.jpg" /><br /> <input
				class="txt" type="file" name="albumImage" /> <label class="error"></label></td>
		</tr>
		<tr>
			<td>歌手：</td>
			<td><input class="txt" type="text" name="artist"
				value="${album.artist}" /> <label class="error"></label></td>
		</tr>
		<tr>
			<td>唱片分类：</td>
			<td><select name="genre.id">
					<c:forEach var="c" items="${genres}">
						<c:if test="${c.id==album.genre.id}">
							<option value="${c.id}" selected="selected">${c.name}</option>
						</c:if>
						<c:if test="${c.id!=album.genre.id}">
							<option value="${c.id}">${c.name}</option>
						</c:if>
					</c:forEach>
			</select> <label class="error"></label></td>
		</tr>
		<tr>
			<td>单价：</td>
			<td><input class="txt" type="text" name="price"
				value="${album.price}" /> <label class="error"></label></td>
		</tr>
		<tr>
			<td>发行日期：</td>
			<td><input class="txt" type="text" name="dateRelease"
				value="<fmt:formatDate value="${album.dateRelease}"/>" /> <label
				class="error"></label></td>
		</tr>
		<tr>
			<td>唱片详细信息：</td>
			<td><textarea name="description"
					style="width: 400px; height: 120px;">${album.description}</textarea>
				</td>
			</tr>
			<tr>
				<td></td>
				<td><input id="btnSubmit" type="submit" name="btnSubmit"
					value="保存" /></td>
			</tr>
		</table>
	</form>
</div>
